import WebSocketClient from "./WebSocketClient";

export default class MessageManager{
    public static socketClient:WebSocketClient|null

    public static sendData(data:Object|string){
        if(MessageManager.socketClient==null){
            throw "消息管理器未初始化socket客户端，无法发送消息";
        }
        if(data instanceof Object){
            MessageManager.socketClient?.sendData(JSON.stringify(data))
        }else{
            MessageManager.socketClient?.sendData(data)
        }
    }
}